package com.xl.interfacedemo;

import java.util.ArrayList;

public class StudentOperatorImpl1 implements StudentOperator{
    @Override
    public void printAllInfo(ArrayList<Student> students) {
        System.out.println("--------------全班全部学生信息如下：");
        for (Student student : students) {
            System.out.println(student.getName() + " " + student.getSex() + " " + student.getScore());
        }
        System.out.println("-----------------------");
    }

    @Override
    public void printAverageScore(ArrayList<Student> students) {
        System.out.println("--------------全班各科平均分如下：");
        double sum = 0;
        for (Student student : students) {
            sum += student.getScore();
        }
        System.out.println("平均分：" + sum / students.size());
    }
}
